package com.tanhua.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tanhua.domain.Log;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface LogMapper extends BaseMapper<Log> {

    @Select("select count(distinct user_id) from tb_log where type=#{type} and log_time=#{time}")
    Integer findnumRegistered(@Param("type") String type, @Param("time") String time);

    @Select("select count(distinct user_id) from tb_log where log_time=#{time}")
    Integer findnumActive(@Param("time") String time);

    @Select("select COUNT(distinct user_id) from tb_log where type='0102' and log_time=#{yesterday}\n" +
            "and user_id in (select distinct user_id from tb_log where log_time=#{time})\t")
    Integer findnumRetention1d(@Param("yesterday") String yesterday, @Param("time") String time);
}
